<template>
  <div>
    <NavBar @submit="submit" :isShow="false"></NavBar>
    <br>
    <el-card>
      <el-row>
        <el-col :span="24">
          <div class="图表1">
            <ECharts :options="config"></ECharts>
          </div>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script setup>
import NavBar from '@/components/navBar/Index.vue'
import ECharts from '@/components/Echarts/Index.vue'
import { options, options2 } from './data.js'
import { getOptions } from '@/api/Benefit.js'
import { ref } from "vue";



const config = ref(options2)

const search = async (data) => {
  const res = await getOptions(data || {
    startTime: '1672502400000',
    endTime: Date.now()
  })
  config.value.xAxis.data = res.data.map(_ => _._id)
  config.value.series[0].data = res.data.map(_ => _.total.toFixed(2))
}
search()
const submit = (data) => {
  search(data)
}
</script>

<style scoped>
.图表1 {
  height: 600px;
}
</style>